1. Field of the Invention
The present invention relates to a memory allocation. More particularly, the present invention relates to a memory allocation method for supporting direct memory access and a terminal implementing the memory allocation method.
2. Description of the Related Art
A terminal, such as a computer or a mobile terminal, is provided with diverse devices for implementing various functions and these functions are executed using application programs stored in memory. The memory is also responsible for storing data generated while the application programs are running. The computer or mobile terminal operates under the control of a Central Processing Unit (CPU). That is, the devices read out the data from the memory to execute specific operations and store the data generated during the execution of the operations within the memory under the control of the CPU. Accordingly, the greater the number of devices there are under the control of the CPU, the greater the CPU overhead increases, resulting in degradation of performance. In order to prevent the performance degradation of the CPU, a Direct Memory Access (DMA) technique has been proposed in which the devices directly access the memory for reading and/or writing independently of the CPU. DMA allows devices to access the memory and transfer data under the control of a DMA controller without subjecting the CPU to a heavy overhead.
The various types of data related to the operations of the terminal are stored within a memory in a distributed manner. That is, although the data are related to the same device operation, they are distributively stored in a specific memory region. The data are stored at their corresponding addresses, referred to by pointers, to be read in a sequence of operations for a specific function. In a case where a DMA device accesses the memory to read the data from the distributed addresses, the next address is automatically acquired by adding one (1) to the previous address rather than a pointer. In other words, a DMA device cannot read the data which are stored distributively in the conventional manner, through the direct access. In order to input and/or output the data in a DMA mode, the data should be stored within the memory in a continuous manner. That is, in order for the device to operate normally, the data are stored at continuous addresses in consideration of the characteristics of DMA. Accordingly, there is a need to develop an efficient memory allocation method that is capable of assigning continuous data addresses to protect from a degradation of CPU performance.